package com.zkingsoft.services.bus.impl;

import com.zkingsoft.services.bus.BusParameterSettingsService;
import com.zkingsoft.pojo.PaginationVO;
import com.zkingsoft.model.bus.BusParameterSettings;
import com.zkingsoft.dao.bus.BusParameterSettingsDao;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.zkingsoft.exception.GlobleException;
import com.zkingsoft.util.ModelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

/**
 * This field was generated by Zking.software.Codegen.
 * @date 2016-11-28 16:55
 */
@Service("busParameterSettingsService")
public class  BusParameterSettingsServiceImpl implements    BusParameterSettingsService  {

	
	@Autowired
	private BusParameterSettingsDao busParameterSettingsDao;
	
	
	@Override
	public int add(BusParameterSettings busParameterSettings){
		
		return busParameterSettingsDao.insert(busParameterSettings);
		
	}
	
	@Override
	public int batchAdd(List<BusParameterSettings>  busParameterSettingsList) {
		return busParameterSettingsDao.batchInsert(busParameterSettingsList);
	}
	
	
   	
    @Override
	public int modifyByMap(BusParameterSettings oldBusParameterSettings
	,BusParameterSettings newBusParameterSettings){
	
		if (!ModelUtils.isModified(oldBusParameterSettings, newBusParameterSettings)) {
			return 1;
		}
		Map<String, Object> modifyMap=null;
		try {
			modifyMap = ModelUtils.comparePojo2Map(oldBusParameterSettings, newBusParameterSettings);
		} catch (Exception e) {
			new GlobleException("数据对比失败");
		}
		if (modifyMap.size() > 0) {
			modifyMap.put("paramId", oldBusParameterSettings.getParamId());
			busParameterSettingsDao.updateByMap(modifyMap);
		}
		return 1;
	}
	
	@Override
	public int modifyByModel(BusParameterSettings busParameterSettings){
	
		return busParameterSettingsDao.updateByModel(busParameterSettings);
	
	}
	
	
	
	@Override
	public int remove(List<Long> list){
	
		return busParameterSettingsDao.deleteByIds(list);
	
	}

	@Override
	public int removeById(Long paramId){
	
		return busParameterSettingsDao.deleteById(paramId);
	
	}
	
	@Override
	public int removeByModel(BusParameterSettings busParameterSettings){
	
		return busParameterSettingsDao.deleteByModel(busParameterSettings);
	
	}
	
	
	@Override
	public List<BusParameterSettings> findInPage(BusParameterSettings busParameterSettings,  PaginationVO pageVo){
	
		return busParameterSettingsDao.selectInPage(busParameterSettings , pageVo);
	
	}
	
	@Override
	public List<BusParameterSettings> findByModel(BusParameterSettings busParameterSettings){
	
		return busParameterSettingsDao.selectByModel(busParameterSettings);
	
	}
	
	@Override
	public int  findTotal(BusParameterSettings busParameterSettings){
	
		return busParameterSettingsDao.selectTotalRecord(busParameterSettings);
	
	}
	
	@Override
	public BusParameterSettings  findById(Long paramId){
	
		return busParameterSettingsDao.selectById(paramId);
	
	}

   	
	 
	
}